-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
39 lines (33 loc) · 817 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <string.h>
int main(){
int t, r, g, b, i = 1,m, p;
char str[5];
scanf("%d", &t);
while(t--){
scanf("%s", str);
scanf("%d %d %d", &r, &g, &b);
if(strcmp(str, "max") == 0){
if(r > g && r > b)
p = r;
else if(g > r && g > b)
p = g;
else
p = b;
}
else if(strcmp(str, "min") == 0){
if(r < g && r < b)
p = r;
else if(g < r && g < b)
p = g;
else
p = b;
}
else if(strcmp(str, "mean") == 0)
p = (r + g + b) / 3;
else
p = (r * 0.3) + (g * 0.59) + (b * 0.11);
printf("Caso #%d: %d\n", i++, p);
}
return 0;
}